#include <stdio.h>
int main()
{
	char in[20] = "EASY", out[20],stack[20];
	int h, i, j,len;
	while(1){
		scanf("%s%s", in, out);
		for(len = 0; in[len] != '\0'; len++)
		h = i = j = 0;
		while(i < len){
			stack[h++] = in[i];
			while(h > 0 && stack[h - 1] == out[j]){
				h--;
				j++;		
			}
			i++;	
		}
		if(j == len)
			printf("OK\n");
		else 
			printf("NO\n");
	}

}
